//
//  NormsView.m
//  EasyToTesco
//
//  Created by 我的 on 16/3/29.
//  Copyright © 2016年 Jack. All rights reserved.
//

#import "NormsView.h"

@implementation NormsView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

- (instancetype)initWithFrame:(CGRect)frame andShopNorms:(NSDictionary *)shopNorms {
    
    self = [[NormsView alloc] initWithFrame:frame];
    
    NSArray *colorArr = shopNorms[@"yanse"];
    NSInteger colorBtnCount = colorArr.count;
    
    [self addColorBtn:colorBtnCount];
    
    return self;
}


- (void)addColorBtn:(NSInteger)colorBtnCount {
    
    for (int i = 0; i < colorBtnCount; i ++) {
        UIButton *btn = [[UIButton alloc] init];
        
        [btn addTarget:self action:@selector(colorBtnClick:) forControlEvents:UIControlEventTouchUpInside];
        
        [self addSubview:btn];
    }
}

- (void)colorBtnClick:(UIButton *)sender {
    
    self.btnTitle = sender.titleLabel.text;
}

@end
